﻿using System;
using System.Collections.Generic;
using SmartCard.Framework;

namespace SmartCardClient.ViewModels
{
	internal class SelectCardViewModel : DialogViewModel
	{
		private ISmartCardReaderManager _manager;
		private IEnumerable<ISmartCardReader> _readers;

		public SelectCardViewModel(ISmartCardReaderManager manager, Action closeAction)
			: base(closeAction)
		{
			if (manager == null)
			{ throw new ArgumentNullException("manager"); }

			_manager = manager;
			_readers = _manager.ManagedSmartCardReaders;
		}

		public IEnumerable<ISmartCardReader> Readers
		{
			get
			{
				return _readers;
			}
			set
			{
				_readers = value;
				Changed(() => Readers);
			}
		}

		public ISmartCardReader SelectedReader
		{ get; set; }
	}
}
